// electron/preload.js
const { contextBridge, ipcRenderer } = require('electron');

// 安全地暴露 API 给渲染进程
contextBridge.exposeInMainWorld('electronAPI', {
  openFolderDialog: () => ipcRenderer.invoke('open-folder-dialog'),
  ffmpegExecPromise: (command) => ipcRenderer.invoke('ffmpeg-exec-promise', command),
  ffmpegExec: (command, callback) => ipcRenderer.invoke('ffmpeg-exec', command, callback),
  process: () => process,
  path: () => require('path'),
  fs: () => require('fs'),
  os: () => require('os'),
});
